package com.abu.cms.controller;


import com.abu.cms.pojo.Banner;
import com.abu.cms.service.BannerService;

import com.abu.utils.Resp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author 阿布
 * @since 2020-06-20
 */
@RestController
@RequestMapping("/educms/bannerfront")
public class BannerController {

    @Autowired
    private BannerService bannerService;

    @GetMapping("getAllBanner")
    public Resp getAllBanner() {
        List<Banner> list = this.bannerService.list();
        if (CollectionUtils.isEmpty(list)) {
            return Resp.error();
        }
        return Resp.ok().data("list", list);
    }


}

